<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
    $api->group([
        'namespace' => '\\App\\Api\\Controllers',
    ], function ($api) {


        $api->post('/auth/login', 'AuthController@login'); //店长登录

        $api->post('/boss/login', 'AuthController@bossLogin'); //boss登录

        $api->post('/zhan/login', 'AuthController@zhanLogin'); //战区登录

        $api->post('/auth/wxsave', 'AuthController@wxsave'); //微信登录
        $api->post('/auth/proxy', 'AuthController@proxyLogin'); //代理登录

        $api->post('upfile', 'AuthController@upfile'); //上传
        $api->post('uploads', 'IndexController@uploads'); // 文件上传

        // 公共接口
        $api->post('sms', 'AuthController@smsCode'); // 短信 验证码
        $api->post('area', 'IndexController@area');

        $api->post('/test','IndexController@test'); // 意见反馈

        $api->post('/about','IndexController@about'); // 关于

    

        //获取登录用户的收货地址列表
        $api->group(['middleware' => ['refresh.token']], function ($api) {
            $api->resource('regions', 'RegionAPIController');

            $api->post('/user/add','UserController@addUser'); // 添加员工
            $api->post('/user/list','UserController@userList'); // 员工列表
            $api->post('/deal/create','DealController@dealCreate'); //员工业绩录入
            $api->post('/store/create','DealController@storeCreate'); //门店业绩录入
            $api->post('/store/deal','DealController@deal'); //门店首页
            $api->post('/boss/rank','DealController@rank'); //排行榜
            $api->post('/boss/emp','DealController@emp'); //员工

            $api->post('/jindian','DealController@jindian');    //进店量
            $api->post('/yeji','DealController@yeji');          //业绩量
            $api->post('/huiyuan','DealController@huiyuan');    //会员量
            $api->post('/yuangong','DealController@yuangong');  //员工曾量
            $api->post('/sanda','DealController@sanda');        //三搭三约
            $api->post('/yueding','DealController@yueding');    //项目约定
            $api->post('/zhizhao','DealController@zhizhao');    //直招功能
            $api->post('/add/learn','CourseController@addLearn');    //店长添加课程学习
            $api->post('/course','CourseController@course');    //课程列表
            $api->post('/course/list','CourseController@courseList');    //子课程列表
            $api->post('/boss/tongji','DealController@tongji');    //boss首页
            $api->post('/store/list','DealController@storeList');    //门店类别
            $api->post('/boss/data','DealController@data');    //boss数据

            $api->post('/rate','CourseController@rate');    //boss数据
            $api->post('/zqtj','DealController@zhanqutongji');    //boss数据
            $api->post('/user/del','UserController@deluser');    //boss数据

        });
    });
});

